import { RouteRecordRaw } from 'vue-router';
import { Layout } from '@/router/constant';
import { DeploymentUnitOutlined } from '@vicons/antd';
import { renderIcon } from '@/utils/index';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 *
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/job',
    name: 'job',
    redirect: '/job/baseInfo',
    component: Layout,
    meta: {
      title: '任务管理',
      icon: renderIcon(DeploymentUnitOutlined),
      sort: 6,
      permissions: ['job_baseInfo','job_list','job_instanceList'],
    },
    children: [
      {
        path: 'baseInfo',
        name: 'job_baseInfo',
        meta: {
          title: '基本信息',
          permissions: ['job_baseInfo'],
        },
        component: () => import('@/views/job/baseInfo.vue'),
      },
      {
        path: 'list',
        name: 'job_list',
        meta: {
          title: '任务列表',
          permissions: ['job_list'],
        },
        component: () => import('@/views/job/jobList.vue'),
      },
      {
        path: 'instanceList',
        name: 'job_instanceList',
        meta: {
          title: '任务实例',
          permissions: ['job_instanceList'],
        },
        component: () => import('@/views/job/instanceList.vue'),
      },
    ],
  },
];

export default routes;
